

package empresa.model;
import java.sql.ResultSet;
import model.BasicBean;


public class Canales extends BasicBean {


        public String   idSubDistribuidor      = "";
        public String   alias                  = "";
        public String   password               = "";
        public String   direccion              = "";
        public String   telefono               = "";
        public String   email                  = "";
        public String   idPersona              = "";
        public String   idRol                  = "";

        public Canales() {
        }

        public Canales( ResultSet rs ) {
                try {
                        id                     = validateString( rs.getString( "id" ) );
                        idSubDistribuidor      = validateString( rs.getString( "idSubDistribuidor" ) );
                        alias                  = validateString( rs.getString( "alias" ) );
                        password               = validateString( rs.getString( "password" ) );
                        direccion              = validateString( rs.getString( "direccion" ) );
                        telefono               = validateString( rs.getString( "telefono" ) );
                        email                  = validateString( rs.getString( "email" ) );
                        idPersona              = validateString( rs.getString( "idPersona" ) );
                        idRol                  = validateString( rs.getString( "idRol" ) );
                } catch ( Exception e ) { System.out.println( e ); }
        }

    @Override
        public String getUpdateSql() {
                String sql = "";
                if( id.equals( "" ) ){
                        sql = "insert into Canales( idSubDistribuidor, alias, password, direccion, telefono, email, idPersona, idRol ) values( '" +
                        idSubDistribuidor + "', '" +
                        alias + "', '" +
                        password + "', '" +
                        direccion + "', '" +
                        telefono + "', '" +
                        email + "', '" +
                        idPersona + "', '" +
                        idRol + "' )";
                } else {
                        sql = "update Canales set idSubDistribuidor = '" +
                        idSubDistribuidor + "', alias= '" +
                        alias + "', password= '" +
                        password + "', direccion= '" +
                        direccion + "', telefono= '" +
                        telefono + "', email= '" +
                        email + "', idPersona= '" +
                        idPersona + "', idRol= '" +
                        idRol + "' where id = '" + id + "'";
                }
           return sql;
        }

     @Override
    public String getHtmlRow() {
        String sz = "";

        sz += ("<td class='st4middle'>" + idPersona + "</td>");
        sz += ("<td class='st4middle'>" + direccion + "</td>");
        sz += ("<td class='st4middle'>" + telefono + "</td>");
        sz += ("<td class='st4middle'>" + email + "</td>");
        return sz;
      }




      @Override
    public String getIdentifier() {
        return "idCanales=" + id;
    }




   }
